<template>
  <el-form  :model="formInline" class="demo-form-inline">
    <el-form-item label="账号">
      <el-input v-model="formInline.login_name" placeholder="请输入账号" clearable />
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="formInline.password" placeholder="请输入密码" clearable />
    </el-form-item>
    <el-form-item label="工号">
      <el-input v-model="formInline.no" placeholder="请输入密码" clearable />
    </el-form-item>
    <el-form-item label="姓名">
      <el-input v-model="formInline.name" placeholder="请输入密码" clearable />
    </el-form-item>
    <el-form-item label="邮箱">
      <el-input v-model="formInline.email" placeholder="请输入密码" clearable />
    </el-form-item>
    <el-form-item label="手机">
      <el-input v-model="formInline.phone" placeholder="请输入密码" clearable />
    </el-form-item>
    <el-form-item label="用户类型">
      <el-select
        v-model="formInline.user_type"
        placeholder="请输入用户类型"
        clearable
      >
        <el-option label="员工" value="0" />
        <el-option label="组长" value="1" />
        <el-option label="主管" value="2" />
        <el-option label="总经理" value="3" />
        <el-option label="董事长" value="110" />
      </el-select>
    </el-form-item>
    <el-form-item label="性别">
        <el-radio-group v-model="formInline.sex">
            <el-radio value="1">男</el-radio>
            <el-radio value="0">女</el-radio>
        </el-radio-group>
    </el-form-item>
    <el-form-item label="是否启用">
        <el-radio-group v-model="formInline.login_flag">
            <el-radio value="1">启用</el-radio>
            <el-radio value="0">禁用</el-radio>
        </el-radio-group>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">Query</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import axios from 'axios';
import { ElMessage } from 'element-plus';
import { reactive } from 'vue'

const formInline = reactive({
    login_name: '',
    password: '',
    no: '',
    name:'',
    email:'',
    phone:'',
    user_type:'',
    sex:'1',
    mgr_type:'0',
    avatar:"/",
    login_flag:'1'
})

const onSubmit = () => {
    console.log(formInline)
  axios({
    method:"post",
    url:"http://1.117.93.87:8000/rbacxie/api/User/userCreate",
    data:formInline
  })
  .then(res=>{
    if(res.data.success==true){
        ElMessage.success(res.data.message)
    }
    else{
        ElMessage.success(res.data.message)
    }
  })
}
</script>

<style>
.demo-form-inline .el-input {
  --el-input-width: 220px;
}

.demo-form-inline .el-select {
  --el-select-width: 220px;
}
</style>
